#ifndef ENGINE_H
#define ENGINE_H

#include <QObject>
#include <QWaitCondition>
#include <QSharedPointer>
#include <QThread>

class Port;
class EngineData;
class Oscillator;
class Sequencer;

class Engine: public QThread
{
public:
    explicit Engine(QObject * parent = NULL);
    ~Engine();
    void setWaitCondition(QWaitCondition & waitCondition);
    Port & getPort(bool isOut);

    static void setSampleRate(int sampleRate);
    static void setBufSize(int bufSize);

private:
    QWaitCondition * waitCondition_;
    void run();
    QSharedPointer <Port> outPort_ , inPort_;    

    QSharedPointer <Oscillator> osc_;
    bool isFinishing_;
    QSharedPointer <EngineData> data_;
    QSharedPointer <Sequencer> seq_;


};

#endif // ENGINE_H
